
{% import 'appbuilder/general/lib.html' as lib %}

{% set begin_sep_label = '<td class="col-lg-2">' %}
{% set end_sep_label = '</td>' %}
{% set begin_sep_field = '<td>' %}
{% set end_sep_field = '</td>' %}

<form id="model_form" action="" method="post" enctype="multipart/form-data">
    {{form.hidden_tag()}}

    {% set title = '' %}
    {% if form.title.data: %}
    {%      set title = form.title.data %}
    {% endif %}

    {% set summary = '' %}
    {% if form.summary.data: %}
    {%      set summary = form.summary.data %}
    {% endif %}

    {% set show_public = '' %}
    {% if form.published.data: %}
    {%      set show_public = 'checked' %}
    {% endif %}

    {% set content = '' %}
    {% if form.content.data: %}
    {%      set content = form.content.data %}
    {% endif %}

    <div>
        <div>
            <h4>Title</h4>
            <input class="form-control" id="title" name="title" placeholder="Title" required="" type="text" value="{{title}}">
        </div>
        <div>
            <h4>Summary</h4>
            <input class="form-control" id="summary" name="summary" placeholder="Summary" required="" type="text" value="{{summary}}">
        </div>
        <div>
            <h4>Public</h4>
            <input id="published" name="published" required="" type="checkbox" value="{{form.published.data}}" {{show_public}}>
        </div>
        <div>
            <h4>Content</h4>
            <script id="container" name="content" type="text/plain">{{content|safe}}</script>
        </div>
    </div>

    {{ lib.render_form_controls() }}
</form>